package org.naivecoders.ai.types;

public class MaybeBowl {
	public static final MaybeBowl NOTHING = new MaybeBowl(null);
	public static final MaybeBowl SOMETHING = new MaybeBowl(new Bowl());

	public static MaybeBowl newBowl(Bowl b) {
		return new MaybeBowl(b);
	}

	private final Bowl bowl;

	private MaybeBowl(Bowl bowl) {
		super();
		this.bowl = bowl;
	}

	public boolean isNothing() {
		return this == NOTHING;
	}

	public Bowl get() {
		assert bowl != null;

		return bowl;
	}

	@Override
	public String toString() {
		if (isNothing()) {
			return "NOTHING";
		}
		return get().toString();
	}
}
